<!DOCTYPE html>

<html lang="zh-Hans">
  <head>
    <meta charset="utf-8" />
    <meta name="author" content="rogepi" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="/vue.global.js"></script>
    <title>1-counter</title>
  </head>

  <body>
    <!-- Vue.js 的核心是一个允许采用简洁
    的模板语法来声明式地将数据渲染进 DOM 的系统 -->
    <div id="counter">Counter: {{counter}}</div>

    <script>
      const Counter = {
        data() {
          return {
            counter: 0,
          };
        },
        mounted() {
          setInterval(() => {
            this.counter++;
          }, 1000);
        },
      };
      Vue.createApp(Counter).mount('#counter');
    </script>
  </body>
</html>
